package edu.bjfu.klotski;


import edu.bjfu.klotski.R;
import edu.bjfu.klotski.R.layout;
import edu.bjfu.klotski.R.menu;
import edu.bjfu.klotski.BLL.ConfigListAdapter;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.support.v4.app.NavUtils;

public class ConfigActivity extends Activity {

	private ListView list1;
	private ListView list2;
	private ListView list3;
	
	String array1[] = {"声音","震动"};
	String array2[] = {"提示步数","自定义布局"};
	String array3[] = {"检查更新","关于"};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_config);
        //getActionBar().setDisplayHomeAsUpEnabled(true);
        list1 = (ListView) findViewById(R.id.list1);
		list2 = (ListView) findViewById(R.id.list2);
		list3 = (ListView) findViewById(R.id.list3);
		list1.setAdapter(new ConfigListAdapter(this,array1));
		list2.setAdapter(new ConfigListAdapter(this,array2));
		list3.setAdapter(new ConfigListAdapter(this,array3));
		list2.setOnItemClickListener(new OnItemClickListener(){

			public void onItemClick(AdapterView<?> parent, View v, int position, long id)
				{
					if(position==1)
					{
						Intent i=new Intent(ConfigActivity.this,LayoutManageActivity.class);
						startActivity(i);
					}
				}
			});
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_config, menu);
        return true;
    }

    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
//            case android.R.id.home:
//                NavUtils.navigateUpFromSameTask(this);
//                return true;
        }
        return super.onOptionsItemSelected(item);
    }

}
